home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / shells / tcshsrc.zoo / tcsh / tc.os.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-10  |  10.8 KB  |  428 lines

  1. /* $Header: /home/hyperion/mu/christos/src/sys/tcsh-6.00/RCS/tc.os.h,v 3.12 1991/08/06 02:00:24 christos Exp $ */
  2. /*
  3.  * tc.os.h: Shell os dependent defines
  4.  */
  5. /*-
  6.  * Copyright (c) 1980, 1991 The Regents of the University of California.
  7.  * All rights reserved.
  8.  *
  9.  * Redistribution and use in source and binary forms, with or without
  10.  * modification, are permitted provided that the following conditions
  11.  * are met:
  12.  * 1. Redistributions of source code must retain the above copyright
  13.  *    notice, this list of conditions and the following disclaimer.
  14.  * 2. Redistributions in binary form must reproduce the above copyright
  15.  *    notice, this list of conditions and the following disclaimer in the
  16.  *    documentation and/or other materials provided with the distribution.
  17.  * 3. All advertising materials mentioning features or use of this software
  18.  *    must display the following acknowledgement:
  19.  *    This product includes software developed by the University of
  20.  *    California, Berkeley and its contributors.
  21.  * 4. Neither the name of the University nor the names of its contributors
  22.  *    may be used to endorse or promote products derived from this software
  23.  *    without specific prior written permission.
  24.  *
  25.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  26.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  29.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  30.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  31.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  32.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  33.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  34.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  35.  * SUCH DAMAGE.
  36.  */
  37. #ifndef _h_tc_os
  38. #define _h_tc_os
  39.  
  40. #ifdef OREO
  41. # include <sys/time.h>
  42. # include <sys/resource.h>
  43. # ifdef POSIX
  44. #  ifdef T_BREAK
  45. #   undef T_BREAK
  46. #  endif /* T_BREAK */
  47. #  include <sys/tty.h>
  48. #  include <termios.h>
  49. # endif /* POSIX */
  50. #endif /* OREO */
  51.  
  52. #ifdef titan
  53. extern int end;
  54. #endif /* titan */
  55.  
  56. #ifdef hpux
  57. # ifdef lint
  58. /*
  59.  * Hpux defines struct ucred, in <sys/user.h>, but if I include that
  60.  * then I need to include the *world*
  61.  * [all this to pass lint cleanly!!!]
  62.  * so I define struct ucred here...
  63.  */
  64. struct ucred {
  65.     int     foo;
  66. };
  67. # endif /* lint */
  68.  
  69. /*
  70.  * hpux 7.0 does not define it
  71.  */
  72. # ifndef CSUSP
  73. #  define CSUSP 032
  74. # endif    /* CSUSP */
  75.  
  76. # ifndef hp9000s500
  77. #  include <sys/bsdtty.h>
  78. # endif
  79.  
  80. # ifndef POSIX
  81. #  ifdef BSDJOBS
  82. #   define getpgrp(a) getpgrp2(a)
  83. #   define setpgrp(a, b) setpgrp2(a, b)
  84. #  endif /* BSDJOBS */
  85. # endif    /* POSIX */
  86. #endif /* hpux */
  87.  
  88. /*
  89.  * ISC does not define CSUSP
  90.  */
  91. #ifdef ISC
  92. # ifndef CSUSP
  93. #  define CSUSP 032
  94. # endif    /* CSUSP */
  95. #endif /* ISC */
  96.  
  97. /*
  98.  * XXX: This will be changed soon to 
  99.  * #if (SVID > 0) && defined(TIOCGWINSZ)
  100.  * If that breaks on your machine, let me know.
  101.  */
  102. #if defined(INTEL) || defined(u3b2) || defined (u3b5) || \
  103.     defined(ub15) || defined(u3b20d) || defined(ISC) || defined(SCO) 
  104. #ifdef TIOCGWINSZ
  105. /*
  106.  * for struct winsiz
  107.  */
  108. # include <sys/stream.h>
  109. # include <sys/ptem.h>
  110. #endif /* TIOCGWINSZ */
  111. # define NEEDgethostname
  112. #endif /* INTEL || att || isc || sco */
  113.  
  114. #ifdef IRIS4D
  115. # include <sys/time.h>
  116. # include <sys/resource.h>
  117. /*
  118.  * BSDsetpgrp() and BSDgetpgrp() are BSD versions of setpgrp, etc.
  119.  */
  120. # define setpgrp BSDsetpgrp
  121. # define getpgrp BSDgetpgrp
  122. #endif /* IRIS4D */
  123.  
  124. /*
  125.  * Stat
  126.  */
  127. #ifdef ISC
  128. /* these are not defined for _POSIX_SOURCE under ISC 2.2 */
  129. # ifndef S_IFMT
  130. #  define S_IFMT  0170000        /* type of file */
  131. #  define S_IFDIR 0040000        /* directory */
  132. #  define S_IFCHR 0020000        /* character special */
  133. #  define S_IFBLK 0060000        /* block special */
  134. #  define S_IFREG 0100000        /* regular */
  135. #  define S_IFIFO 0010000        /* fifo */
  136. #  define S_IFNAM 0050000        /* special named file */
  137. # endif /* S_IFMT */
  138. #endif /* ISC */
  139.  
  140. #ifdef S_IFMT
  141. # if !defined(S_ISDIR) && defined(S_IFDIR)
  142. #  define S_ISDIR(a)    (((a) & S_IFMT) == S_IFDIR)
  143. # endif    /* ! S_ISDIR && S_IFDIR */
  144. # if !defined(S_ISCHR) && defined(S_IFCHR)
  145. #  define S_ISCHR(a)    (((a) & S_IFMT) == S_IFCHR)
  146. # endif /* ! S_ISCHR && S_IFCHR */
  147. # if !defined(S_ISBLK) && defined(S_IFBLK)
  148. #  define S_ISBLK(a)    (((a) & S_IFMT) == S_IFBLK)
  149. # endif    /* ! S_ISBLK && S_IFBLK */
  150. # if !defined(S_ISREG) && defined(S_IFREG)
  151. #  define S_ISREG(a)    (((a) & S_IFMT) == S_IFREG)
  152. # endif    /* ! S_ISREG && S_IFREG */
  153. # if !defined(S_ISFIFO) && defined(S_IFIFO)
  154. #  define S_ISFIFO(a)    (((a) & S_IFMT) == S_IFIFO)
  155. # endif    /* ! S_ISFIFO && S_IFIFO */
  156. # if !defined(S_ISNAM) && defined(S_IFNAM)
  157. #  define S_ISNAM(a)    (((a) & S_IFMT) == S_IFNAM)
  158. # endif    /* ! S_ISNAM && S_IFNAM */
  159. # if !defined(S_ISNAM) && defined(S_IFNAM)
  160. #  define S_ISNAM(a)    (((a) & S_IFMT) == S_IFNAM)
  161. # endif    /* ! S_ISNAM && S_IFNAM */
  162. # if !defined(S_ISLNK) && defined(S_IFLNK)
  163. #  define S_ISLNK(a)    (((a) & S_IFMT) == S_IFLNK)
  164. # endif    /* ! S_ISLNK && S_IFLNK */
  165. # if !defined(S_ISSOCK) && defined(S_IFSOCK)
  166. #  define S_ISSOCK(a)    (((a) & S_IFMT) == S_IFSOCK)
  167. # endif    /* ! S_ISSOCK && S_IFSOCK */
  168. #endif /* S_IFMT */
  169.  
  170. #ifndef S_IEXEC
  171. # define S_IEXEC 0000100
  172. #endif /* S_IEXEC */
  173. #ifndef S_IXOTH
  174. # define S_IXOTH (S_IEXEC >> 6)
  175. #endif /* S_IXOTH */
  176. #ifndef S_IXGRP
  177. # define S_IXGRP (S_IEXEC >> 3)
  178. #endif /* S_IXGRP */
  179. #ifndef S_IXUSR
  180. # define S_IXUSR S_IEXEC
  181. #endif /* S_IXUSR */
  182.  
  183. /*
  184.  * Access()
  185.  */
  186. #ifndef F_OK
  187. # define F_OK 0
  188. #endif /* F_OK */
  189. #ifndef X_OK
  190. # define X_OK 1
  191. #endif /* X_OK */
  192. #ifndef W_OK
  193. # define W_OK 2
  194. #endif /* W_OK */
  195. #ifndef R_OK
  196. # define R_OK 4
  197. #endif /* R_OK */
  198.  
  199. /*
  200.  * Open()
  201.  */
  202. #ifndef O_RDONLY
  203. # define O_RDONLY    0
  204. #endif /* O_RDONLY */
  205. #ifndef O_WRONLY
  206. # define O_WRONLY    1
  207. #endif /* O_WRONLY */
  208. #ifndef O_RDWR
  209. # define O_RDWR        2
  210. #endif /* O_RDWR */
  211.  
  212. /*
  213.  * Lseek()
  214.  */
  215. #ifndef L_SET
  216. # ifdef SEEK_SET
  217. #  define L_SET        SEEK_SET
  218. # else
  219. #  define L_SET        0
  220. # endif    /* SEEK_SET */
  221. #endif /* L_SET */
  222. #ifndef L_INCR
  223. # ifdef SEEK_CUR
  224. #  define L_INCR    SEEK_CUR
  225. # else
  226. #  define L_INCR    1
  227. # endif    /* SEEK_CUR */
  228. #endif /* L_INCR */
  229. #ifndef L_XTND
  230. # ifdef SEEK_END
  231. #  define L_XTND    SEEK_END
  232. # else
  233. #  define L_XTND    2
  234. # endif /* SEEK_END */
  235. #endif /* L_XTND */
  236.  
  237. #ifdef _SEQUENT_
  238. # define NEEDgethostname
  239. #endif /* _SEQUENT_ */
  240.  
  241. #if defined(BSD) && defined(POSIXJOBS) 
  242. # define setpgid(pid, pgrp)    setpgrp(pid, pgrp)
  243. #endif /* BSD && POSIXJOBS */
  244.  
  245. #if defined(BSDJOBS) && !(defined(POSIX) && defined(POSIXJOBS))
  246. # if !defined(_AIX370) && !defined(_AIXPS2)
  247. #  define setpgid(pid, pgrp)    setpgrp(pid, pgrp)
  248. # endif /* !_AIX370 && !_AIXPS2 */
  249. # define tcsetpgrp(fd, pgrp)    ioctl((fd), TIOCSPGRP, (ioctl_t) &(pgrp))
  250. # define NEEDtcgetpgrp
  251. #endif /* BSDJOBS && !(POSIX && POSIXJOBS) */
  252.  
  253. #ifdef RENO
  254. /*
  255.  * Older versions of RENO had this broken. It is fixed now. 
  256.  * In any case, we use ours...
  257.  */
  258. # define tcsetpgrp(fd, pgrp)    ioctl((fd), TIOCSPGRP, (ioctl_t) &(pgrp))
  259. # define NEEDtcgetpgrp
  260. #endif /* RENO */
  261.  
  262. #ifdef DGUX
  263. # define setpgrp(a, b) setpgrp2(a, b)
  264. # define getpgrp(a) getpgrp2(a)
  265. #endif /* DGUX */
  266.  
  267. #ifdef SXA
  268. # ifndef _BSDX_
  269. /*
  270.  * Only needed in the system V environment.
  271.  */
  272. #  define setrlimit     bsd_setrlimit
  273. #  define getrlimit    bsd_getrlimit
  274. # endif    /* _BSDX_ */
  275. # ifndef NOFILE
  276. #  define    NOFILE    64
  277. # endif    /* NOFILE */
  278. #endif /* SXA */
  279.  
  280. #ifndef POSIX
  281. # define mygetpgrp()    getpgrp(0)
  282. #else /* POSIX */
  283. # if defined(BSD) || defined(sun)
  284. #  define mygetpgrp()    getpgrp(0)
  285. # else /* BSD || sun */
  286. #  define mygetpgrp()    getpgrp()
  287. # endif    /* BSD || sun */
  288. #endif /* POSIX */
  289.  
  290.  
  291. #if SVID > 0 && !defined(OREO) && !defined(sgi)
  292. # define NEEDgetwd
  293. #endif /* SVID > 0 && !OREO && !sgi */
  294.  
  295. #ifndef S_IFLNK
  296. # define lstat stat
  297. #endif /* S_IFLNK */
  298.  
  299.  
  300. #if defined(BSDTIMES) && !defined(_SEQUENT_)
  301. typedef struct timeval timeval_t;
  302. #endif /* BSDTIMES && ! _SEQUENT_ */
  303.  
  304. #ifdef NeXT
  305. /*
  306.  * From Tony_Mason@transarc.com, override NeXT's malloc stuff.
  307.  */
  308. # define malloc tcsh_malloc
  309. # define calloc tcsh_calloc
  310. # define realloc tcsh_realloc
  311. # define free tcsh_free
  312. #endif /* NeXT */
  313.  
  314.  
  315. #if !defined(POSIX) || defined(sun)
  316. extern time_t time();
  317. extern char *getenv();
  318. extern int atoi();
  319. extern char *ttyname();
  320.  
  321. #ifndef __MINT__
  322. # ifndef hpux
  323. extern int abort();
  324. extern int qsort();
  325. # else
  326. extern void abort();
  327. extern void qsort();
  328. # endif
  329. #endif /* __MINT__ */
  330. extern void perror();
  331.  
  332. #ifndef NEEDgethostname
  333. extern int gethostname();
  334. #endif
  335.  
  336. # ifdef BSDSIGS
  337. #  if defined(_AIX370) || defined(MACH) || defined(NeXT) || defined(_AIXPS2)
  338. extern int sigvec();
  339. extern int sigpause();
  340. #  else    /* _AIX370 || MACH || NeXT || _AIXPS2 */
  341. #   if !defined(apollo) || !defined(__STDC__)
  342. extern sigret_t sigvec();
  343. extern void sigpause();
  344. #   endif /* !apollo || !__STDC__ */
  345. #  endif /* _AIX370 || MACH || NeXT || _AIXPS2 */
  346. extern sigmask_t sigblock();
  347. extern sigmask_t sigsetmask();
  348. # endif    /* BSDSIGS */
  349.  
  350. # ifndef killpg
  351. extern int killpg();
  352. # endif    /* killpg */
  353.  
  354. # ifndef lstat
  355. extern int lstat();
  356. # endif    /* lstat */
  357.  
  358. #ifdef BSD
  359. extern uid_t getuid(), geteuid();
  360. extern gid_t getgid(), getegid();
  361. #endif /* BSD */
  362.  
  363. # ifdef SYSMALLOC
  364. extern memalign_t malloc();
  365. extern memalign_t realloc();
  366. extern memalign_t calloc();
  367. extern void free();
  368. # endif    /* SYSMALLOC */
  369.  
  370. # ifdef BSDTIMES
  371. extern int getrlimit();
  372. extern int setrlimit();
  373. extern int getrusage();
  374. extern int gettimeofday();
  375. # endif    /* BSDTIMES */
  376.  
  377. # if defined(NLS) && !defined(NOSTRCOLL) && !defined(NeXT)
  378. extern int strcoll();
  379. # endif
  380.  
  381. # ifdef BSDJOBS
  382. #  ifdef BSDTIMES
  383. extern int wait3();
  384. #  else    /* ! BSDTIMES */
  385. #   if !defined(POSIXJOBS) && !defined(_SEQUENT_)
  386. extern int wait3();
  387. #   else /* POSIXJOBS || _SEQUENT_ */
  388. extern int waitpid();
  389. #   endif /* POSIXJOBS || _SEQUENT_ */
  390. #  endif /* ! BSDTIMES */
  391. # else /* !BSDJOBS */
  392. #  if SVID < 3
  393. extern int ourwait();
  394. #  else    /* SVID >= 3 */
  395. extern int wait();
  396. #  endif /* SVID >= 3 */
  397. # endif    /* ! BSDJOBS */
  398.  
  399. # ifdef BSDNICE
  400. extern int setpriority();
  401. # else /* !BSDNICE */
  402. extern int nice();
  403. # endif    /* !BSDNICE */
  404.  
  405. extern void setpwent();
  406. extern void endpwent();
  407. extern struct passwd *getpwuid(), *getpwnam(), *getpwent();
  408.  
  409. # ifndef getwd
  410. extern char *getwd();
  411. # endif    /* getwd */
  412. #else /* POSIX */
  413.  
  414. # if defined(sun) && !defined(__GNUC__)
  415. extern char *getwd();
  416. # endif    /* sun && ! __GNUC__ */
  417.  
  418. # ifdef SCO
  419. extern char *ttyname();   
  420. # endif /* SCO */
  421.  
  422. # ifdef RENO
  423. extern void perror();        /* Reno declares that in stdio.h :-( */
  424. # endif    /* RENO */
  425. #endif /* POSIX */
  426.  
  427. #endif /* _h_tc_os */
  428.